package edu.ut.ece382c.valloy.ui;

import java.awt.Button;
import java.awt.Component;
import java.util.Vector;

import javax.swing.SwingWorker;

import edu.ut.ece382c.valloy.translator.tester.ValloyTestDriver;

public class TestSuiteWorker extends SwingWorker<Boolean, Void> {

	private ValloyTestDriver driver;
    private String path;
    private Vector<Component> disabledControls;
    
    public void init (ValloyTestDriver driver, String path, Vector<Component> disabledControls) {
    	this.driver = driver;
    	this.path = path;
    	this.disabledControls = disabledControls;
	}
	
	@Override
    public Boolean doInBackground() {
    	driver.RunTestDrive(path);
    	return Boolean.TRUE;
    }

    @Override
    public void done() {
    	for (Component disabledButton :disabledControls){
    		disabledButton.setEnabled(true);
    		driver=null;
    	}
    }
}
